package impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import pojo.Role;
import service.RoleListService;
import service.RoleService;

import java.util.List;

/**
 * Created by zuoxiao
 * on 2019/7/6.
 */
 @Service
public class RoleListServiceImpl implements RoleListService {

   @Autowired
   private RoleService roleService = null;
   Logger logger = Logger.getLogger(RoleListServiceImpl.class);

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)
    public int insertRoleList(List<Role> roleList) {
    int count = 0;
        for (Role r :
                roleList) {
            count += roleService.insertRole(r);
            logger.info(r);
        }
        return count;
    }
}
